/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package conf;

/**
 *
 * @author dell
 */
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
public class XmlUtil 
{    
/**
 * @param url
 * @return 
 */    
public static Document getDocument(String url)
{
     Document document=null;
     try
     {
         DocumentBuilder builder=DocumentBuilderFactory.newInstance().newDocumentBuilder();
         document=builder.parse(url);
     }
     catch(Exception e)
     {
         e.printStackTrace();
     }
     return document;        
}
/**
 * @param url 
 * @param root
 * @return 
 */
public static NodeList getNodeList(String url,String root)
{
     NodeList list=null;
     try
     {
         DocumentBuilder builder=DocumentBuilderFactory.newInstance().newDocumentBuilder();
         Document document=builder.parse(url);
         list=document.getElementsByTagName(root);
     }
     catch(Exception e)
     {
          e.printStackTrace();
     }
     return list;
}
}
